package com.slkj.shilixiaoyuanapp.entity;

import android.os.Parcel;
import android.os.Parcelable;

import com.chad.library.adapter.base.entity.AbstractExpandableItem;
import com.chad.library.adapter.base.entity.MultiItemEntity;
import com.slkj.shilixiaoyuanapp.entity.contacts.PersonBean;
import com.slkj.shilixiaoyuanapp.ui.main.message.MessageContactsAdater;

/**
 * Created  on 2018-07-18
 *
 * @author 唐开阔
 * @describe
 */
public class MessageContactsGroupEntity  extends AbstractExpandableItem<PersonBean> implements MultiItemEntity,Parcelable {
    private String name;
    private boolean isCheck;
    private int size;
    public MessageContactsGroupEntity(String name) {
        this.name = name;
    }

    protected MessageContactsGroupEntity(Parcel in) {
        name = in.readString();
        isCheck = in.readByte() != 0;
        size = in.readInt();
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(name);
        dest.writeByte((byte) (isCheck ? 1 : 0));
        dest.writeInt(size);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<MessageContactsGroupEntity> CREATOR = new Creator<MessageContactsGroupEntity>() {
        @Override
        public MessageContactsGroupEntity createFromParcel(Parcel in) {
            return new MessageContactsGroupEntity(in);
        }

        @Override
        public MessageContactsGroupEntity[] newArray(int size) {
            return new MessageContactsGroupEntity[size];
        }
    };

    public boolean isCheck() {
        return isCheck;
    }

    public void setCheck(boolean check) {
        isCheck = check;
    }

    public int getSize() {
        return size;
    }

    public void setSize(int size) {
        this.size = size;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public int getLevel() {
        return 0;
    }

    @Override
    public int getItemType() {
        return MessageContactsAdater.TYPE_GROUP;
    }
}
